<template>
  <div>
    <el-container id="home">
      <el-header class="home-header">
        <template v-if="user.userrole == 'student'">
          <el-menu
              :default-active="this.$route.path"
              class="el-menu-demo"
              mode="horizontal"
              background-color="#545c64"
              text-color="#fff"
              active-text-color="#ffd04b"
              router
          >
            <el-menu-item index="/home/">主页</el-menu-item>
            <el-menu-item index="/home/MineExamination">我的考试</el-menu-item>
            <el-menu-item index="/home/Organization">组织</el-menu-item>
            <el-menu-item index="/login" @click="loginOut">退出登录</el-menu-item>
          </el-menu>
        </template>
        <template v-else-if="user.userrole == 'teacher'">
          <el-menu
              :default-active="this.$route.path"
              class="el-menu-demo"
              mode="horizontal"
              background-color="#545c64"
              text-color="#fff"
              active-text-color="#ffd04b"
              router
          >
            <el-menu-item index="/home/">主页</el-menu-item>
            <el-menu-item index="/home/MineExamination">我的考试</el-menu-item>
            <el-menu-item index="/home/QuestionBase">试题库</el-menu-item>
            <el-menu-item index="/home/Paper">试卷中心</el-menu-item>
            <el-menu-item index="/home/Organization">组织</el-menu-item>
            <el-menu-item index="/home/Examination">考试</el-menu-item>
            <el-menu-item index="/login" @click="loginOut">退出登录</el-menu-item>
          </el-menu>
        </template>
      </el-header>
      <el-main class="main">
        <router-view></router-view>
      </el-main>
     
    </el-container>
  </div>
</template>

<script>

export default {
  data() {
    return{
      user:null
    }

  },
  created() {
    this.user =this.$store.getters.getuser;
  },
  methods:{
    loginOut(){
      this.$store.commit('removeuser');

    }
  }
};
</script>

<style>


#home{
  width: 100%;
  height: 80%;
  min-height: 100vh;
  padding:0;
  overflow-y:auto;
  overflow-x:hidden;
}

.home-header{
  padding:0;
}
.main {
  background-color: #fafafa;
  color: #6d5555;
  text-align: center;
  width: 100%;
  height:100%;
  padding:0;
}


</style>